package com.superteam.zzl.Des;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.superteam.zzl.activity.R;

import java.util.List;

/**
 * Created by Administrator on 2017/1/9.
 */
public class MyGridAdapter  extends BaseAdapter{
    private Context context;
    private List<Country.DataBean.CityListBean> list;
   private MyAdapter adapter;
    public MyGridAdapter(Context context, List<Country.DataBean.CityListBean> list) {
        this.context = context;
        this.list = list;

    }

    @Override
    public int getCount() {
        return 1;
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        adapter=new MyAdapter(context,list);
        if (convertView==null){
            vh=new ViewHolder();
            convertView=View.inflate(context, R.layout.destionfragment,null);
            vh.gv=(MyGridView)convertView.findViewById(R.id.de_frag_gv);
            convertView.setTag(vh);
        }else {
            vh=(ViewHolder)convertView.getTag();
        }

         vh.gv.setAdapter(adapter);
        return convertView;
    }
    class ViewHolder{
        MyGridView gv=new MyGridView(context);
    }
}
